﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace rmfastwin
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_DragEnter(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                string path = ((Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();
                if (System.IO.Directory.Exists(path))
                {
                    e.Effect = DragDropEffects.Link;
                    return;
                }
            }

            e.Effect = DragDropEffects.None;


        }

        private void Form1_DragDrop(object sender, DragEventArgs e)
        {
            string path = ((Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();
            this.label1.Text = path;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.AllowDrop = true;
        }
        

        private void button1_Click(object sender, EventArgs e)
        {
            var path = this.label1.Text;
            if (System.IO.Directory.Exists(path))
            {
                if (DeleteTool.StartDeletePath(path))
                {
                    var info = new FormInfo();
                    info.InfoPath = path;
                    info.Show();
                }
            }
             
        }
    }
}
